import random

def bubble_sort(nums):#冒泡排序---从小到大排序 
    for j in range(len(nums)-1):
        for k in range(len(nums)-j-1):
            if nums[k] > nums[k+1]:
                nums[k+1],nums[k] = nums[k],nums[k+1]

def choose_sort(nums:list[int]):#选择排序---从小到大排序
    for i in range(len(nums)):
        min = nums[i]
        index = i
        for j in range(i,len(nums)):
            if min > nums[j]:
                min = nums[j]
                index = j
        nums[i],nums[index] = nums[index], nums[i]

def insert_sort(nums:list[int]):
    for i in range(len(nums)-1):
        j = i - 1 #手里牌的下标
        temp = nums[i]
        while(j>0 and nums[j]>temp):
            nums[j+1] = nums[j]
            j -= 1
        nums[j+1] = temp




if __name__ == "__main__":
    a = [random.randint(1,19) for i in range(1,10)]
    b = [random.randint(1,19) for i in range(1,10)]
    c = [random.randint(1,19) for i in range(1,10)]

    print("a:",a)
    bubble_sort(a)
    print("冒泡排序，排序后:",a)
    print("b:",b)
    choose_sort(b)
    print("插入排序，排序后:",b)
    print("b:",c)
    choose_sort(c)
    print("插入排序，排序后:",c)